package com.psl.action.work.halfproduct;

import com.psl.services.work.list.halfProductServices;
import org.apache.struts2.ServletActionContext;

import javax.servlet.http.HttpServletRequest;

public class halfproductCount {
    public String execute() {
        HttpServletRequest request = ServletActionContext.getRequest();
        String h_area = request.getParameter("h_area");
        String month = request.getParameter("month");
        String date = request.getParameter("date");
        String year = request.getParameter("year");
        String h_date="";
        if (year == null && month == null && date == null) {
            halfProductServices hps = new halfProductServices();
            hps.Allpt();
            return "success";
        }
        if (year != null && month == null && date == null) {
            h_date = year;
            System.out.println("1:"+h_date);
            halfProductServices hps = new halfProductServices();
            hps.selectprint(h_area, h_date);
            return "success";
        }
        if (year != null && month != null && date == null) {
            h_date = month;
            System.out.println("2:"+h_date);
            halfProductServices hps = new halfProductServices();
            hps.selectprint(h_area, h_date);
            return "success";
        }
        if (year != null && month != null && date != null) {
            h_date = date;
            System.out.println("3:"+h_date);
            halfProductServices hps = new halfProductServices();
            hps.selectprint(h_area, h_date);
            return "success";
        }
        return "success";
    }
}